<script>
  function logArr(arr) {
    for (let i = 0; i < arr.length; i++) {
      console.log(arr[i]);
    }
  }
  logArr([1, 2, 3, 4, 5, 6])

  function logArr(arr) {
    const dfs = (idx) => {
      if (idx === arr.length) return
      console.log(arr[idx]);
      dfs(idx + 1)
    }
    dfs(0)
  }
  logArr([1, 2, 3, 4, 5, 6])
</script>